import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    curSongPlayIndex: 0,
    songPlayList: [],
    playType: 0,
  },
  // 触发事件 相当于方法
  // 用户需要通过触发这个方法借此来保存数据
  mutations: {
    saveSongList(state, songList) {
      state.songPlayList = songList;
    },
    savePlayType(state, playType) {
      state.playType = playType;
    }
  }
})
